#include <gtest\gtest.h>
#include "Maths\Vector2.h"

using namespace Shiny::Maths;

TEST(Vector2, Constructor)
{
	Vector2 first(1, 2);
	EXPECT_FLOAT_EQ(1, first.x);
	EXPECT_FLOAT_EQ(2, first.y);
}

TEST(Vector2, VectorAddition)
{
	Vector2 first(1, 2);
	Vector2 second(3, 4);
	Vector2 result1 = first + second;
	Vector2 result2 = second + first;

	EXPECT_FLOAT_EQ(4, result1.x);
	EXPECT_FLOAT_EQ(6, result1.y);

	EXPECT_FLOAT_EQ(4, result2.x);
	EXPECT_FLOAT_EQ(6, result2.y);


}
TEST(Vector2, ScalarMultiplication)
{
	Vector2 first(1.0f, 2.0f);
	float scalar = 5.0f;
	Vector2 result1 = scalar * first;

	
	Vector2 vec(-7, 3);
	Vector2 result2 = 8 * vec;
	Vector2 result3 = vec * 8;
	
	
	EXPECT_FLOAT_EQ(5.0f, result1.x);
	EXPECT_FLOAT_EQ(10.0f, result1.y);
	EXPECT_FLOAT_EQ(result2.x, -56);
	EXPECT_FLOAT_EQ(result2.y, 24);
	EXPECT_FLOAT_EQ(result2.x, result3.x);
	EXPECT_FLOAT_EQ(result2.y, result3.y);


}